import 'package:flutter/material.dart';
import '../../../main/widgets/ui_constant.dart';

class UText {
  UText._privateConstructor();

  static Text getMainText(String text) {
    return Text(text, style: UITextStyle.main_text);
  }

  static Text getSubText(String text) {
    return Text(text, style: UITextStyle.sub_text);
  }

  static Text get(String text, Color color, double size,
      {FontWeight fw = FontWeight.normal,
      TextAlign? textAlign,
      TextOverflow? overflow}) {
    return Text(
      text,
      textAlign: textAlign,
      style: TextStyle(color: color, fontSize: size, fontWeight: fw),
      overflow: overflow,
    );
  }

  static Widget getBkText(String text, double size,
      {Color color = Colors.white,
      required double width,
      required double height,
      Color? bkColor,
      Color borderColor = Colors.transparent,
      double borderWidth = 0,
      double radius = 0}) {
    return Container(
      width: width,
      height: height,
      decoration: BoxDecoration(
        color: bkColor,
        borderRadius: BorderRadius.circular(radius),
        border: borderWidth > 0 ? Border.all(color: borderColor, width: borderWidth) : null,
      ),
      alignment: Alignment.center,
      child: UText.get(text, color, size),
    );
  }

  static Widget getBkButton(String text, double size,
      {Color color = Colors.white,
      required double width,
      required double height,
      Color? bkColor,
      double radius = 0,
      EdgeInsetsGeometry padding = EdgeInsets.zero,
      VoidCallback? onPressed}) {
    return MaterialButton(
      minWidth: width,
      height: height,
      color: bkColor,
      padding: padding,
      elevation: 0,
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(radius)),
      child: UText.get(text, color, size),
      onPressed: onPressed,
    );
  }
}
